//
//  CityModel.swift
//  swift3.0Exercise
//
//  Created by Aaron on 2016/12/26.
//  Copyright © 2016年 com.lpz. All rights reserved.
//

import ObjectMapper

class CitysModel: Mappable {
    
    var citys : [CityModel]?
    
    init(){}
    
    required init?(map: Map) {
        mapping(map: map)
    }
    
    func mapping(map: Map) {
        citys <- map["citys"]
    }

}

class CityModel: Mappable {
    
    var province : String?
    var citySort : Int?
    var name : String?
    var proID : Int?
    var cityID : Int?
    var pinin : String?
    var firstLetter : String?
    var newPinyin : String{
        get {
            return (self.pinin?.replacingOccurrences(of: " ", with: ""))!
        }
    }
    
    init(){}
    
    required init?(map: Map) {
        mapping(map: map)
    }
    
    func mapping(map: Map) {
        citySort <- map["citySort"]
        name <- map["name"]
        proID <- map["proID"]
        cityID <- map["cityID"]
        pinin <- map["pinin"]
        firstLetter <- map["firstLetter"]
    }

    
}
